The present invention relates to storage systems, and more particularly, this invention relates to a tape drive configured to dynamically change a buffer flush threshold based on historical transaction size.
A conventional tape drive includes a data buffer which acts as a cache to remove any performance impact caused by tape motion (back hitching of the tape to move the tape to a position to write data) which makes writing to tape appear to be slower than desired. For example, when a host application sends data to a tape drive, the tape drive stores the data in the data buffer. If an adequate amount of data is stored in the buffer, the drive will begin to write the data to the tape. When the buffer becomes empty after writing the data to the tape, the tape drive back hitches to the position where writing ceased (e.g., tape motion to rewind the tape and reposition to the last written data and restart the write operation from the end of the last written data when additional data to write is received). The back hitch is used in order to write data to the tape without capacity loss which would occur if the tape were not back hitched. If the back hitch is not invoked at buffer empty, a gap between written data will remain on the tape where there is no data written. During the back hitch, the tape drive continues to receive the data from the host application until the buffer becomes filled.
In this way, the data buffer is able to hide the performance impact caused by back hitching the tape. If the host transfer rate is slower than the minimum transfer rate for the tape drive to read/write the data, it is preferred to store the data in the data buffer for as long as possible. Then the tape drive may start the write/read operation, in order to avoid an extra back hitch which may cause damage to the tape.
For example, if the drive starts to write data on the tape until the buffer is partially emptied of data, there is less data to be written to the tape. Therefore, a back hitch after writing the data occurs sooner than if more data had been stored in the buffer prior to starting the writing operation. If the tape drive starts to write data after an adequate amount of data is resident in the buffer, there is more data to be written to the tape and the number of back hitches over the course of operation of the tape drive is reduced.
However, storing more and more data to the buffer is not practicable in some cases, such as when a synchronization (sync) command is issued. The sync command is issued by the host application, and when the tape drive receives the sync command, the tape drive is forced to write all unwritten data from the drive buffer to the tape. If there is a large amount of data in the buffer, the elapsed time needed to write all of the data to the tape will be longer than desired.
Therefore, while the tape drive attempts to store as much data in the drive buffer as possible to reduce the number of back hitches for slow streaming writing, the receipt of a sync command then causes the performance of the tape drive to be degraded.